package org.example.cloudalibaba.myhandler;

import cn.hutool.core.util.IdUtil;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.example.springcloud.common.Result;

public class CustomBlockHandler {
    // 资源有的参数，兜底方法也必须有
    public static Result<String> resourceHandleBlock(BlockException e) {
        return Result.success("请求资源被限流了, uuid = {}", IdUtil.fastSimpleUUID());
    }

    public static Result<String> urlHandleBlock(BlockException e) {
        return Result.success("请求url被限流了, uuid = {}", IdUtil.fastSimpleUUID());
    }

    public static Result<String> defaultHandleBlock(BlockException e) {
        return Result.success("请求被限流了, uuid = {}", IdUtil.fastSimpleUUID());
    }

}
